package com.guaoran.interview.spring.autowired.config;

import com.guaoran.interview.spring.autowired.service.InjectService;
import com.guaoran.interview.spring.autowired.service.QualifierService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * @author : 孤傲然
 * @description : Qualifier config
 * @date :2020/1/3 16:13
 */
@Component
public class WebConfig {
    @Primary
    @Bean
    public QualifierService firstQualifierService(){
//        System.out.println("first");
        QualifierService qualifierService = new QualifierService();
        qualifierService.setInjectService(new InjectService());
        return qualifierService;
    }

    @Bean
    public QualifierService secondQualifierService(){
//        System.out.println("second");
        return new QualifierService();
    }
}
